package cn.tedu.spring.file;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.PropertySource;
import org.springframework.stereotype.Component;

/**
 * PropertySource:加载外部属性文件,即: resources/application.properties 文件;
 */
@PropertySource(value = "classpath:application.properties")//加载到路径
@Component
public class Dataase {
    @Value("${databaseUrl}")
    private String url;
    @Value("${uname}")
    private String uname;
    @Value("${password}")
    private String pwd;

    @Override
    public String toString() {
        return "Dataase{" +
                "url='" + url + '\'' +
                ", uname='" + uname + '\'' +
                ", pwd='" + pwd + '\'' +
                '}';
    }
}
